<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>JsonFromJaxb Example</title>
<style type="text/css"><!--
  .figure { text-align:center;
            margin: 20px}
  .cliSample { background-color:lightgray }
--></style>
</head>


  <body>
    <h1>JsonFromJaxb Example</h1>
    <p>This example demonstrates how to use JSON representation of JAXB based resources. 
    <p>A simple web application is presented with two resources: a flight list and a aircraft type list. A client can obtain
the former list or update it using XML or JSON representation. The second list is read-only and shows how to provide JSON array using List&lt;JAXBBean&gt; objects.
     

    <h2>Contents</h2>
    <p>The flight list web resource is implemented by <code>com.sun.jersey.samples.jsonfromjaxb.resources.FlightList</code> class.
    The aircraft type list web resource is implemented by <code>com.sun.jersey.samples.jsonfromjaxb.resources.AircraftTypeList</code> class.
    <p>The mapping of the URI path space is presented in the following table:</p>
	<table border="1">
	<tr>
	<th>URI path</th>
	<th>Resource class</th>
	<th>HTTP methods</th>
	</tr>

	<tr>
	<td>/flights/</td>
	<td>FlightList</td>
	<td>GET, PUT</td>
	</tr>

	<tr>
	<td>/aircrafts/</td>
	<td>AircraftTypeList</td>
	<td>GET</td>
	</tr>

    </table>

    <h2>Running the Example</h2>
         <p>Run the example as follows:</p>
        <blockquote><pre>
mvn clean compile exec:java</pre></blockquote>
        <p>This deploys the JSON from JAXB example using 
            <a href="https://grizzly.dev.java.net/">Grizzly</a>
        </p>
        <p>A <a href="http://wadl.dev.java.net/#spec">WADL description</a> may be accessed at the URL:</p>
        <blockquote><code><a href="http://localhost:9998/jsonfromjaxb/application.wadl">http://localhost:9998/jsonfromjaxb/application.wadl</a></code></blockquote>
       <p>Following steps are using <a href="http://curl.haxx.se/">cURL</a> command line tool: 
        <p>Get the list of flights in JSON format:</p>
        <blockquote><pre>curl -HAccept:application/json http://localhost:9998/jsonfromjaxb/flights</pre></blockquote>
    
        <p>Get the list of flights in XML format:</p>
        <blockquote><pre>curl -HAccept:application/xml http://localhost:9998/jsonfromjaxb/flights</pre></blockquote>

        <p>Get the list of aircraft types in JSON format:</p>
        <blockquote><pre>curl -HAccept:application/json http://localhost:9998/jsonfromjaxb/aircrafts</pre></blockquote>

        <p>You can also see test classes at <code>src/main/test</code> subdirectory
         for detail information how to consume the service using Jersey client API</p>
  </body>
</html>
